import { UiButton } from "@/shared/Uikit";
import { UiSelectField } from "@/shared/Uikit/UiSelectField";
import { UiTextField } from "@/shared/Uikit/UiTextField";
import { useGetCurrentUser } from "@/entities/user/model/useGetCurrentUser";
import { useCreateDiscipline } from "../../create-discipline/model/useCreateDiscipline";
import { useRemoveDiscipline } from "../model/useRemoveDiscipline";
import { useEffect, useState } from "react";
import { useGetAllDisciplines } from "@/entities/discipline/model/useGetAllDisciplines";

type RemoveDisciplineButtonProps = {
    disciplineId: number,
    onSuccess?: ()=>void
}

export default function RemoveDisciplineButton(props: RemoveDisciplineButtonProps) {
    const { handleMutate, errorMessage, isSuccess } = useRemoveDiscipline()
    useEffect(()=>{
        if(isSuccess && props.onSuccess){
            props.onSuccess()
        }
    },[isSuccess])
    return (
        <div>
            <UiButton onClick={() => handleMutate(props.disciplineId)} variant='secondary'>
                Удалить дисциплину
            </UiButton>
        </div>
    )
}